
package com.limoilux.cobolux.core;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;

public abstract class RessourceCreator implements IRunnableWithProgress
{

	IWorkbench workbench;
	protected IStructuredSelection selection;

	@Override
	public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
	{
		IWorkspace workspace = null;
		IWorkspaceRoot root = null;

		workspace = ResourcesPlugin.getWorkspace();
		root = workspace.getRoot();

		try
		{
			this.create(monitor, root);
		}
		catch (CoreException e)
		{
			e.printStackTrace();
		}
		finally
		{

		}
	}

	public void init(IWorkbench workbench, IStructuredSelection selection)
	{
		this.workbench = workbench;
		this.selection = selection;
	}

	public abstract void create(IProgressMonitor monitor, IWorkspaceRoot root) throws CoreException;

}
